//
//  DJTool.m
//  DualJoy
//
//  Created by lijunge on 2019/11/14.
//  Copyright © 2019 lijunge. All rights reserved.
//

#import "DJTool.h"

@implementation DJTool

+ (BOOL)isIPhone_X_Series {
    
    static BOOL is_X_Series = NO;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        if (@available(iOS 11.0, *)) {
            is_X_Series = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;
        }
    });
    return is_X_Series;
}

+ (BOOL)validObj:(id)obj {
    
    if (obj == nil) {
        return NO;
    }
    if ([obj isKindOfClass:[NSNull class]]) {
        return NO;
    }
    return YES;
}

+ (BOOL)validStr:(NSString *)str {
    
    if (![self validObj:str]) {
        return NO;
    }
    if (![str isKindOfClass:[NSString class]]) {
        return NO;
    }
    if ([str length] == 0) {
        return NO;
    }
    return YES;
}

@end
